package com.jyhz.model.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.jyhz.model.dao.PersonDao;
import com.jyhz.model.dao.PersonDaoPlus;
import com.jyhz.model.pojo.Person;
import org.apache.catalina.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author:谢君臣
 * @Date:2021/6/27-19:55
 * @version:1.0
 * @function:
 */
@Service
public class PersonServiceImpl implements PersonService {

    private final PersonDao personDao;  // 通用mapper进行查询
    private final PersonDaoPlus personDaoPlus;  // mybatisPlus进行查询

    public PersonServiceImpl(PersonDao personDao, PersonDaoPlus personDaoPlus) {
        this.personDao = personDao;
        this.personDaoPlus = personDaoPlus;
    }

    @Override
    public Person getOneById(Long id) {
        //return personDaoPlus.selectById(id);
        return personDaoPlus.selectOne(new QueryWrapper<Person>().lambda().eq(Person::getId, id));
    }

    @Override
    public Person getOneByAccount(String account) {
        return null;
    }

    @Override
    public Person getOneByMobile(String mobile) {
        return null;
    }

    @Override
    public Person getOneByUsername(String username) {
        return null;
    }

    @Override
    public Person getOneByUsernameAndPassword(String username, String password) {
        return personDao.getOneByUsernameAndPassword(username,password);
    }

    @Override
    public List<Person> getPersons() {
        return null;
    }

    @Override
    public List<Person> getPersonsByUsername(String username) {
        return null;
    }
}
